﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Super.Common.DB;
using Super.Common.Strings;
using Super.DomainService;
using Super.Entities;
using Super.Infrastructure;

namespace Super.Web.Areas.Admin.Controllers
{
    public class IndexController : BaseController
    {
        //
        // GET: /Admin/Index/

        public ActionResult Index()
        {
        
            var adp = new DbContextAdapter(false);
            var index = new Dictionary<string, int>();
            
            //取得今天的00：00：00点日期时间
            var date = DateTime.Now.Date.ToShortDateString();
            date = date + " 00:00:00";
            var today = date.ToDateTime();

            //用户
            var userService = new BaseService<User>(adp);
            index.Add("newusers", userService.Repository.Find(a => a.CreateTime > today && a.IsDel == false).Count());
            index.Add("users", userService.Repository.Find(a => a.IsDel == false).Count());

            ViewBag.index = index;
            return View();
        }

    }
}
